/*
 * Sesame Inc.
 * Copyright (c) 2009 All Rights Reserved.
 */
package com.sesame.service;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.transaction.annotation.Transactional;

import com.sesame.domain.Answer;
import com.sesame.domain.Ask;
import com.sesame.domain.Collect;
import com.sesame.domain.Complaint;
import com.sesame.domain.Notice;
import com.sesame.domain.User;
import com.sesame.toolkit.Page;

/**
 * @author shubeta
 * 
 */
@Transactional
public interface UserService {
    public boolean register(HttpServletRequest request, User user, Map model);

    @Transactional(readOnly = true)
    public boolean validatePassword(User user, String confirmPassword, Map model);

    @Transactional(readOnly = true)
    public boolean validateCode(HttpServletRequest request,
            String identifyCode, Map model);

    public boolean findPassword(User user, Map model);

    public boolean newPassword(String code, User user, Map model);

    public boolean modifyPassword(String oldPassword, User user, Map model);

    public boolean editUserinfo(User user, Map model);

    public boolean modifyHeadPic(User user, Map model);

    public void report(Complaint complaint, Map model);

    @Transactional(readOnly = true)
    public User showUser(Integer id);

    @Transactional(readOnly = true)
    public User showUser(String email);

    public void newAsk(String title, String content, HttpServletRequest request);

    @Transactional(readOnly = true)
    public List<Ask> listAsk(Page page);

    public void newAnswer(Integer askId, String content,
            HttpServletRequest request);

    @Transactional(readOnly = true)
    public List<Answer> listAnswer(Integer askId);

    @Transactional(readOnly = true)
    public Ask showAsk(Integer askId);

    public void deleteAsk(Integer askId);

    public void deleteAnswer(Integer answerId);

    public void newCollect(Collect collect);

    @Transactional(readOnly = true)
    public List<Collect> listCollect(Integer userId);

    @Transactional(readOnly = true)
    public Integer getAskCount();

    public void deleteCollect(Integer collectId);

    @Transactional(readOnly = true)
    public List<Collect> listTopCollect(Integer userId);
    
    @Transactional(readOnly = true)
    public List<Notice> listTopNotice();
    
    @Transactional(readOnly = true)
    public Notice showNotice(Integer id);
}